package com.uranus.ptb.sms.client;

import org.apache.log4j.Logger;

import com.ptb.uranus.utils.JedisUtil;

public class SmsClient {
	private static Logger logger = Logger.getLogger(SmsClient.class);
	public static String key= "ptb::sms";
	public static int REGISTER_MESSAGE_TYPE = 1;
	public static int FIND_PASSWORD_TYPE = 2 ;;
	/**
	 * 像redis发送请求
	 * @param phone
	 * @param
	 * @return
	 */
	public static void  setSmsClient(String phone,String validateCode,int type){
		try {
			String value ="{\"phone\":\""+phone+"\",\"message\":\""+validateCode+"\",\"type\":\""+type+"\"}"; 
			JedisUtil.lpush(key.getBytes(), value.getBytes());
			logger.info("Send the request:{\"code\":\"0\",\"message\":\""+phone+"\",\"type\":\""+type+"\"}");
		} catch (Exception e) {
			logger.error("To the client sends a request to fail",e);
		}
	}
	
	public static void main(String[] args) {
		setSmsClient("13621086797", "1234", 1);
	}
}
